package de.kardass.jsmatep.in;

import java.util.ArrayList;
import java.util.List;

import de.kardass.jsmatep.in.config.ParserConfiguration;

/**
 * Class representing the import processor's result.
 * 
 * @author Manfred Kardass (manfred@kardass.de)
 *
 */
public class ImportResult {

    /** List of occurred errors while parsing data */
    private final List<FieldParsingException> errors;

	/**	List of skipped records while parsing records */
	private final List<String> skippedRecords;
	
	/** Used parser configuration */
	private final ParserConfiguration parserConfiguration;
	
	/**	Quantity of mapped records (successfully parsed & mapped value objects) */
	private int countMappedValueObjects = 0;


	
	protected ImportResult(ParserConfiguration parserConfiguration) {
        this.errors = new ArrayList<FieldParsingException>();
		this.skippedRecords = new ArrayList<String>();
		this.parserConfiguration = parserConfiguration;
	}

	public void incrementCountMappedValueObject() {
		++countMappedValueObjects;
	}

	public int getCountMappedValueObjects() {
		return countMappedValueObjects;
	}

	public void addSkippedRecord(String record) {
		skippedRecords.add(record);
	}

	public List<String> getSkippedRecords() {
		return skippedRecords;
	}

	@Deprecated
    public int getSkippedRecordsCount() {
        return skippedRecords.size();
    }
    
    public int getCountSkippedRecords() {
        return skippedRecords.size();
    }

    public ParserConfiguration getParserConfiguration() {
        return parserConfiguration;
    }

    public int getCountErrors() {
        return errors.size();
    }

    public List<FieldParsingException> getErrors() {
        return errors;
    }

    public void addError(FieldParsingException error) {
        errors.add(error);
    }

}
